import random
import string


def generate_test_cases():
    test_cases = []

    # 测试用例1：简单案例
    test_cases.append({"input": "abc", "expected": 3})  # "a", "b", "c"

    # 测试用例2：回文字符串
    test_cases.append({"input": "aaa", "expected": 6})  # "a","a","a","aa","aa","aaa"

    # 测试用例3：随机生成
    for _ in range(3):
        s = "".join(random.choices(string.ascii_lowercase, k=random.randint(5, 10)))
        # 计算预期结果
        n = len(s)
        expected = 0
        for i in range(n):
            # 奇数长度
            l, r = i, i
            while l >= 0 and r < n and s[l] == s[r]:
                expected += 1
                l -= 1
                r += 1
            # 偶数长度
            l, r = i, i + 1
            while l >= 0 and r < n and s[l] == s[r]:
                expected += 1
                l -= 1
                r += 1

        test_cases.append({"input": s, "expected": expected})

    return test_cases


if __name__ == "__main__":
    test_cases = generate_test_cases()
    with open("test.py", "w") as f:
        f.write("test_cases = " + repr(test_cases))
